<template>
  <view class="content">
    <PageBody :properties="pageBody">
      <template v-slot:body>
        <RichText :content="content"/>
      </template>
    </PageBody>
  </view>
</template>

<script>
import PageBody from '@/components/school/pageBody';
import RichText from '@/components/school/richtext';
import parser from "@/components/jyf-parser/jyf-parser";
import * as AgreementApi from '@/api/member/agrrement.js';
const app = getApp();
export default {
  components: {
    "jyf-parser": parser,
    PageBody,RichText
  },
  data() {
    return {
      tagStyle: {
        img: 'width:100%;display:block;',
        table: 'width:100%',
        video: 'width:100%'
      },
      content: ``,
      pageBody: {
        background: 'white',
      },
      params:null
    }
  },

  onLoad(options) {
    // 参数可能是通过 ?params={} 传递
    if (options.params) {
      try {
        this.params = JSON.parse(decodeURIComponent(options.params));
      } catch (e) {
        console.error("参数解析失败", e);
      }
    }
  },

  onShow() {
    console.log("pageHeight", this.pageBody.pageHeight);

    if (!this.params || !this.params.code) return;

    AgreementApi.agreementByCode(this.params.code).then(res => {
      this.content = res.data.content;
    }).catch(err => {
      this.$util.Tips({
        title: err.msg || '获取内容失败'
      });
    });
  }
}
</script>

<style scoped>
* {
  background-color: white !important;
}
page{
  background-color: white !important;
}
</style>
